Skip to content

Conversation

@loicdiridollou
Copy link
Member

  • Closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added (Please use assert_type() to assert the type of any return value)
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md.

@loicdiridollou loicdiridollou requested review from Dr-Irv and cmp0xff and removed request for Dr-Irv January 22, 2026 20:34
@loicdiridollou
Copy link
Member Author

I did not remove all the pytest warn bounded, there is already a ton of stuff to look at so thought I would do it in a follow up. @cmp0xff has already made the changes for dropping the dependency on 3.10 so did not do all of those.

col_fill: Hashable = ...,
drop: _bool = ...,
inplace: Literal[False] = False,
inplace: bool = False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inplace=True still returns None. Please fix and also add a test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted and added

Comment on lines 1376 to 1390
@overload
def stack(
self,
level: IndexLabel = ...,
*,
future_stack: Literal[True],
) -> Self | Series: ...
@overload
def stack(
self,
level: IndexLabel = ...,
dropna: _bool = ...,
sort: _bool = ...,
future_stack: Literal[False] = False,
future_stack: Literal[True] = True,
) -> Self | Series: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both implementations still coexist. I guess we should keep the old implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the old warning message, the future_stack=False is a deprecated implementation so I thought we should not let the user use them, unless they willfully ignore the warning. What do you think?

arr_arrow = cast("ArrowStringArray", pd.array([pd.NA], str))
check(assert_type(arr_arrow, ArrowStringArray), ArrowStringArray, float)
assert pd.isna(assert_type(arr_arrow.dtype.na_value, NAType | float))
# pandas-dev/pandas#63567
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pandas-dev/pandas#54466 will need to be propagated, maybe in a separate PR.

Suggested change
# pandas-dev/pandas#63567
# TODO: pandas-dev/pandas#54466 should give BaseStringArray after 3.0

check(pd.array([*data, *data, np.nan], dtype), BaseStringArray, dtype_na)

if TYPE_CHECKING:
# TODO: pandas-dev/pandas#54466 should give BaseStringArray after 3.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pandas-dev/pandas#54466 will need to be propagated, maybe in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I plan to do those in a separate one, otherwise it is just a massive bunch of changes and so easy to miss something.

Comment on lines 241 to 242
check(assert_type(arr.month_name(), np_1darray_object), BaseStringArray)
check(assert_type(arr.day_name(), np_1darray_object), BaseStringArray)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following needs to work

Suggested change
check(assert_type(arr.month_name(), np_1darray_object), BaseStringArray)
check(assert_type(arr.day_name(), np_1darray_object), BaseStringArray)
check(assert_type(arr.month_name(), BaseStringArray), BaseStringArray)
check(assert_type(arr.day_name(), BaseStringArray), BaseStringArray)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


# interpolate
if PD_LTE_23:
check(assert_type(GB_DF.resample("ME").interpolate(), DataFrame), DataFrame)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need negative tests here?

if PD_LTE_23:
with pytest_warns_bounded(
FutureWarning,
r"The provided callable <function (sum|mean) .*> is currently using ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to disable the previous implementation and add negative tests in if TYPE_CHECKING_INVALID_USAGE

# aggregate
with pytest_warns_bounded(
FutureWarning,
r"The provided callable <function (sum|mean) .*> is currently using ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to disable the previous implementation and add negative tests in if TYPE_CHECKING_INVALID_USAGE

if PD_LTE_23:
with pytest_warns_bounded(
FutureWarning,
r"The provided callable <function (sum|mean) .*> is currently using ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to disable the previous implementation and add negative tests in if TYPE_CHECKING_INVALID_USAGE

Copy link
Member Author

@loicdiridollou loicdiridollou Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something is broken there:

import numpy as np
from pandas import DataFrame

df = DataFrame({"A": ["a"] * 4, "B": range(4)})

df.groupby("A").ewm(1).aggregate(sum)  # fails
df.groupby("A").ewm(1).aggregate("sum") # works
df.groupby("A").ewm(1).aggregate(np.sum) # fails

Raised issue in pandas-dev/pandas#63855

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like they fixed it on main but it will remain broken on 3.0.0, we can decide to ignore the tests until 3.0.1 is released.

if PD_LTE_23:
with pytest_warns_bounded(
FutureWarning,
r"The provided callable <function (sum|mean) .*> is currently using ",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to disable the previous implementation and add negative tests in if TYPE_CHECKING_INVALID_USAGE

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as pandas-dev/pandas#63855

if TYPE_CHECKING_INVALID_USAGE:
s.clip(lower=lower, axis=1) # type: ignore[call-overload] # pyright: ignore[reportArgumentType]
s.clip(lower=lower, axis="column") # type: ignore[call-overload] # pyright: ignore[reportArgumentType]
s.clip(lower=lower, axis=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
s.clip(lower=lower, axis=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType]
s.clip(lower=lower, axis=1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue,reportArgumentType]

FutureWarning,
r"Logical ops \(and, or, xor\) between Pandas objects and dtype-less sequences "
r"\(e.g. list, tuple\) are deprecated",
lower="2.0.99",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe negative tests

FutureWarning,
r"Logical ops \(and, or, xor\) between Pandas objects and dtype-less sequences "
r"\(e.g. list, tuple\) are deprecated",
lower="2.0.99",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe negative tests

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jan 24, 2026

I had started a review, then @cmp0xff did a review, then @loicdiridollou pushed new commits, so I will discard that review, and start from the latest commit. Please let me handle this going forward.

@loicdiridollou
Copy link
Member Author

I will hold on pushing anything until I get your review, there is a lot of changes so it will be easier like this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants